import 'package:get/get.dart';
import 'package:honeypotflutter/publicBussine/loginInfo/bussine_loginExit.dart';
import 'package:honeypotflutter/public/public_alert.dart';
import 'package:package_info_plus/package_info_plus.dart';

class SettingLogic extends GetxController {
  RxString version = RxString("");

  @override
  void onInit() {
    super.onInit();
    getPackageInfo();
  }

  /*
  * 获取包信息
  * */
  getPackageInfo() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    version.value = "V${packageInfo.version}";
  }

  /*
  * 退出登录
  * */
  quit() async {
    HLAlert.showSureCancelAlert(
        title: "退出提示",
        message: "您确定要退出",
        sureAction: (bool isOk) {
          if (isOk == false) {
            return;
          }
          LoginExit.quit();
        });
  }
}
